<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>🚀  欢迎使用</title>
    <link rel="stylesheet" href="/static/css/main.css">
    <link rel="icon"
        href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🚀</text></svg>">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link
        href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap"
        rel="stylesheet">
</head>

<body>
    <!-- 🌌 超级动态背景系统 -->
    <div class="background-container">
        <div class="starfield" id="starfield"></div>
        <div class="nebula-cloud" id="nebulaCloud"></div>
        <div class="hologram-grid"></div>
        <div class="energy-waves"></div>
        <div class="quantum-particles" id="quantumParticles"></div>
        <canvas id="matrixRain" class="matrix-rain"></canvas>
    </div>

    <!-- 🔮 加载屏幕 -->
    <div class="loading-screen" id="loadingScreen">
        <div class="loading-content">
            <div class="cyber-logo">
                <div class="logo-ring"></div>
                <div class="logo-core">🚀</div>
                <div class="logo-text">CYBER LOADER</div>
            </div>
            <div class="loading-bar">
                <div class="loading-fill" id="loadingFill"></div>
            </div>
            <div class="loading-text" id="loadingText">初始化量子引擎...</div>
            <div class="system-info">
                <div class="info-line">🔥 量子处理器已激活</div>
                <div class="info-line">⚡ 神经网络连接中</div>
                <div class="info-line">🌐 全球节点同步中</div>
            </div>
        </div>
    </div>

    <!-- 🔐 密码验证弹窗 -->
    <div class="modal-overlay" id="passwordModal">
        <div class="modal-container">
            <div class="modal-header">
                <div class="modal-title">🔐 系统验证</div>
                <div class="modal-subtitle">请输入访问密码以继续</div>
            </div>
            <form id="passwordForm">
                <div class="form-group">
                    <label for="premiumPassword">🔑 访问密码</label>
                    <input type="password" id="premiumPassword" placeholder="输入系统密码..." required>
                </div>
                <div id="passwordError" style="color: var(--quantum-danger); margin-bottom: 15px; display: none;"></div>
                <div class="btn-group" style="    margin-top: 10px;">
                    <button type="button" id="submitPasswordBtn" class="btn btn-primary">
                        <span>🚀</span> 验证并进入
                    </button>
                    <button type="button" id="cancelPasswordBtn" class="btn btn-secondary">
                        <span>❌</span> 取消
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- 🔐 密码修改弹窗 -->
    <div class="modal-overlay" id="changePasswordModal" style="display: none;">
        <div class="modal-container">
            <div class="modal-header">
                <div class="modal-title">🔐 修改密码</div>
                <div class="modal-subtitle">请输入当前密码和新密码</div>
            </div>
            <form id="changePasswordForm">
                <div class="form-group">
                    <label for="modalCurrentPassword">🔑 当前密码</label>
                    <input type="password" id="modalCurrentPassword" placeholder="输入当前密码..." required>
                </div>
                <div class="form-group">
                    <label for="modalNewPassword">🆕 新密码</label>
                    <input type="password" id="modalNewPassword" placeholder="输入新密码..." required>
                </div>
                <div class="form-group">
                    <label for="modalConfirmPassword">✅ 确认新密码</label>
                    <input type="password" id="modalConfirmPassword" placeholder="再次输入新密码..." required>
                </div>
                <div id="changePasswordError" style="color: var(--quantum-danger); margin-bottom: 15px; display: none;">
                </div>
                <div id="changePasswordSuccess"
                    style="color: var(--quantum-accent); margin-bottom: 15px; display: none;"></div>
                <div class="btn-group">
                    <button type="button" onclick="changePassword()" class="btn btn-primary">
                        <span>🔄</span> 修改密码
                    </button>
                    <button type="button" onclick="closeChangePasswordModal()" class="btn btn-secondary">
                        <span>❌</span> 取消
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- 🎯 主应用容器 -->
    <div class="main-container">
        <!-- 🎛️ 侧边导航栏 -->
        <div class="sidebar">
            <div class="sidebar-header">
                <div class="user-info">
                    <div class="user-avatar">
                        <div class="avatar-ring"></div>
                        <div class="avatar-core">👤</div>
                    </div>
                    <div class="user-details">
                        <div class="username">代飞哥</div>
                        <div class="user-id">🆔 1213423722</div>
                        <div class="user-status">
                            <div class="status-indicator online"></div>
                            <span>🔥 VIP QUANTUM</span>
                        </div>
                    </div>
                </div>
                <div class="system-stats">
                    <div class="stat-item">
                        <span class="stat-label">CPU</span>
                        <div class="stat-bar">
                            <div class="stat-fill" style="width: 45%"></div>
                        </div>
                    </div>
                    <div class="stat-item">
                        <span class="stat-label">RAM</span>
                        <div class="stat-bar">
                            <div class="stat-fill" style="width: 62%"></div>
                        </div>
                    </div>
                    <div class="stat-item">
                        <span class="stat-label">NET</span>
                        <div class="stat-bar">
                            <div class="stat-fill" style="width: 78%"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="menu">
                <div class="menu-item active" onclick="switchPage('douyin')">
                    <div class="menu-icon">🎵</div>
                    <div class="menu-content">
                        <span class="menu-title">抖音解析区</span>
                        <span class="menu-subtitle">TikTok Parser</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
                <div class="menu-item" onclick="switchPage('kuaishou')">
                    <div class="menu-icon">⚡</div>
                    <div class="menu-content">
                        <span class="menu-title">快手解析区</span>
                        <span class="menu-subtitle">Kuaishou Parser</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
                <div class="menu-item" onclick="switchPage('bilibili')">
                    <div class="menu-icon">📺</div>
                    <div class="menu-content">
                        <span class="menu-title">B站解析区</span>
                        <span class="menu-subtitle">Bilibili Parser</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
                <div class="menu-item" onclick="switchPage('vmq')">
                    <div class="menu-icon">💎</div>
                    <div class="menu-content">
                        <span class="menu-title">付费解析区</span>
                        <span class="menu-subtitle">Premium Parser</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
                <div class="menu-item" onclick="switchPage('settings')">
                    <div class="menu-icon">⚙️</div>
                    <div class="menu-content">
                        <span class="menu-title">系统设置</span>
                        <span class="menu-subtitle">System Config</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
                <div class="menu-item" onclick="switchPage('help')">
                    <div class="menu-icon">🛟</div>
                    <div class="menu-content">
                        <span class="menu-title">使用帮助</span>
                        <span class="menu-subtitle">Help Center</span>
                    </div>
                    <div class="menu-indicator"></div>
                </div>
            </div>

            <div class="sidebar-footer">
                <div class="footer-copyright">
                    <strong>© 2025 CYBER TECH</strong>
                </div>
                <div class="quantum-signature">
                    <span class="signature-text">QUANTUM NEXUS POWERED</span>
                    <div class="signature-pulse"></div>
                </div>
            </div>
        </div>

        <!-- 🎨 主内容区域 -->
        <div class="content-area">
            <!-- 🎵 抖音下载页面 -->
            <div class="page active" id="douyinPage">


                <div class="card glow-effect">
                    <div class="card-header">
                        <div class="card-icon">🎵</div>
                        <div class="card-title-group">
                            <span class="card-title">抖音智能解析系统</span>
                            <span class="card-subtitle">Advanced TikTok Content Parser</span>
                        </div>
                        <div class="card-status">
                            <div class="status-dot active"></div>
                            <span>系统在线</span>
                        </div>
                    </div>

                    <!-- 模式切换 -->
                    <div class="nav-tabs">
                        <div class="nav-tab active" onclick="switchMode('video', event)">📹 视频模式</div>
                        <div class="nav-tab" onclick="switchMode('image', event)">🖼️ 图集模式</div>
                    </div>

                    <div class="form-row">
                        <div class="form-group">
                            <label for="videoUrl">🔗 视频链接</label>
                            <input type="text" id="videoUrl" placeholder="粘贴抖音分享链接..." />
                        </div>
                    </div>

                    <div class="form-row">
                        <div class="form-group">
                            <label for="savePath">💾 保存路径</label>
                            <input type="text" id="savePath" value="D:/douyin_downloads/videos" />
                        </div>
                        <div class="form-group" style="flex: 0 0 120px;">
                            <label>&nbsp;</label>
                            <button class="btn btn-secondary" onclick="browsePath()">
                                浏览
                            </button>
                        </div>
                    </div>

                    <div class="btn-group">
                        <button id="downloadBtn" class="btn btn-primary" onclick="startDownload()">
                            <span>🚀</span> 开始解析
                        </button>
                        <button class="btn btn-secondary" onclick="clearLog()">
                            <span>🧹</span> 清空日志
                        </button>
                    </div>

                    <div class="progress-container">
                        <div class="progress-bar">
                            <div class="progress-fill" id="progressFill" style="width: 0%"></div>
                        </div>

                    </div>

                    <div class="log-container" id="logArea">
                        <div class="log-entry info" style="left: -17px;">
                            <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                            <span>🎯 抖音解析系统已启动，等待任务...</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- ⚡ 快手下载页面 -->
            <div class="page" id="kuaishouPage">
                <div class="card glow-effect">
                    <div class="card-header">
                        <div class="card-icon">⚡</div>
                        <div class="card-title-group">
                            <span class="card-title">快手智能解析系统</span>
                            <span class="card-subtitle">Advanced Kuaishou Content Parser</span>
                        </div>
                        <div class="card-status">
                            <div class="status-dot active"></div>
                            <span>系统在线</span>
                        </div>
                    </div>

                    <!-- 模式切换 -->
                    <div class="nav-tabs">
                        <div class="nav-tab active" onclick="switchKuaishouMode('single', event)">🎯 单视频解析</div>
                        <div class="nav-tab" onclick="switchKuaishouMode('batch', event)">📦 批量下载</div>
                    </div>

                    <!-- 单视频解析模式 -->
                    <div class="kuaishou-content active" id="kuaishouSingle">
                        <div class="form-row">
                            <div class="form-group">
                                <label for="kuaishouUrl">🔗 视频链接</label>
                                <input type="text" id="kuaishouUrl" placeholder="粘贴快手分享链接..." />
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="kuaishouPath">💾 保存路径</label>
                                <input type="text" id="kuaishouPath" value="D:/douyin_downloads/kuaishou" />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseKuaishouPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="kuaishouDownloadBtn" class="btn btn-primary" onclick="startKuaishouDownload()">
                                <span>⚡</span> 开始解析
                            </button>
                            <button class="btn btn-secondary" onclick="clearKuaishouLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>
                    </div>

                    <!-- 批量下载模式 -->
                    <div class="kuaishou-content" id="kuaishouBatch">
                        <div class="form-row">
                            <div class="form-group">
                                <label for="kuaishouUserId">👤 用户ID</label>
                                <input type="text" id="kuaishouUserId" placeholder="输入快手用户ID..." />
                                <small
                                    style="color: rgba(255,255,255,0.6); font-size: 0.8rem; margin-top: 5px; display: block;">
                                    💡 从快手用户主页链接中获取用户ID
                                </small>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="kuaishouBatchPath">💾 保存路径</label>
                                <input type="text" id="kuaishouBatchPath" value="D:/douyin_downloads/ks_batch" />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseKuaishouBatchPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="kuaishouBatchDownloadBtn" class="btn btn-primary"
                                onclick="startKuaishouBatchDownload()">
                                <span>📦</span> 开始下载
                            </button>
                            <button class="btn btn-secondary" onclick="clearKuaishouBatchLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>
                    </div>

                    <div class="progress-container" style="margin-top: 153px;">
                        <div class="progress-bar">
                            <div class="progress-fill" id="kuaishouProgressFill" style="width: 0%"></div>
                        </div>

                    </div>

                    <div class="log-container" id="kuaishouLogArea">
                        <div class="log-entry info" style="left: -17px;">
                            <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                            <span>⚡ 快手解析系统已启动，等待任务...</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 📺 B站下载页面 -->
            <div class="page" id="bilibiliPage">
                <div class="card glow-effect">
                    <div class="card-header">
                        <span class="card-icon">📺</span>
                        <span class="card-title" style="right: 62vw;">B站智能解析系统</span>
                    </div>

                    <div class="form-row">
                        <div class="form-group">
                            <label for="bilibiliUrl">🔗 视频链接</label>
                            <input type="text" id="bilibiliUrl" placeholder="粘贴B站视频链接..." />
                        </div>
                    </div>

                    <div class="form-row">
                        <div class="form-group">
                            <label for="bilibiliPath">💾 保存路径</label>
                            <input type="text" id="bilibiliPath" value="D:/douyin_downloads/B_video" />
                        </div>
                        <div class="form-group" style="flex: 0 0 120px;">
                            <label>&nbsp;</label>
                            <button class="btn btn-secondary" onclick="browseBilibiliPath()">
                                浏览
                            </button>
                        </div>
                    </div>

                    <div class="btn-group">
                        <button id="bilibiliDownloadBtn" class="btn btn-primary" onclick="startBilibiliDownload()">
                            <span>📺</span> 开始解析
                        </button>
                        <button class="btn btn-secondary" onclick="clearBilibiliLog()">
                            <span>🧹</span> 清空日志
                        </button>
                    </div>

                    <div class="progress-container">
                        <div class="progress-bar">
                            <div class="progress-fill" id="bilibiliProgressFill" style="width: 0%"></div>
                        </div>

                    </div>

                    <div class="log-container" id="bilibiliLogArea">
                        <div class="log-entry info">
                            <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                            <span>📺 B站解析系统已启动，等待任务...</span>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 💎 付费解析区页面 -->
            <div class="page" id="vmqPage">
                <!-- 子导航 -->
                <div class="nav-tabs">
                    <div class="nav-tab active" onclick="switchVmqMode('single', event)">🎯 单页解析</div>
                    <div class="nav-tab" onclick="switchVmqMode('batch', event)">📦 批量解析</div>
                    <div class="nav-tab" onclick="switchVmqMode('tiefenquan', event)">💠 铁粉圈</div>
                    <div class="nav-tab" onclick="switchVmqMode('tiefenquan-video', event)">🎬 铁粉圈视频</div>
                </div>

                <!-- 单页解析 -->
                <div class="vmq-content active" id="vmqSingle">
                    <div class="card glow-effect">
                        <div class="card-header">
                            <span class="card-icon">🎯</span>
                            <span class="card-title">付费区单页解析</span>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="vmqUrl">🔗 页面链接</label>
                                <input type="text" id="vmqUrl" placeholder="粘贴微密圈页面链接..." />
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="vmqPath">💾 保存路径</label>
                                <input type="text" id="vmqPath" value="D:/douyin_downloads/wxpic" />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseVmqPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="vmqDownloadBtn" class="btn btn-primary" onclick="startVmqDownload()">
                                <span>🎯</span> 开始解析
                            </button>
                            <button class="btn btn-secondary" onclick="clearVmqLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>

                        <div class="progress-container">
                            <div class="progress-bar">
                                <div class="progress-fill" id="vmqProgressFill" style="width: 0%"></div>
                            </div>

                        </div>

                        <div class="log-container" id="vmqLogArea">
                            <div class="log-entry info" style="left: -17px;">
                                <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                                <span>🎯 付费区解析系统已启动，等待任务...</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 批量解析 -->
                <div class="vmq-content" id="vmqBatch">
                    <div class="card glow-effect">
                        <div class="card-header">
                            <span class="card-icon">📦</span>
                            <span class="card-title">付费区批量解析</span>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="vmqBatchCategory">🏷️ 分类名称</label>
                                <input type="text" id="vmqBatchCategory" value="mote" placeholder="输入分类名称..." />
                                <small
                                    style="color: rgba(255,255,255,0.6); font-size: 0.8rem; margin-top: 5px; display: block;">
                                    💡 可用分类: jvid, xiuren, weimimao, fuliji, mote, sentian, hanfu
                                </small>
                            </div>
                            <div class="form-group">
                                <label for="vmqBatchPage">📄 页码</label>
                                <input type="number" id="vmqBatchPage" value="1" min="1" placeholder="页码..." />
                                <small
                                    style="color: rgba(255,255,255,0.6); font-size: 0.8rem; margin-top: 5px; display: block;">
                                    📋 要下载的页码（从1开始）
                                </small>
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="vmqBatchPath">💾 保存路径</label>
                                <input type="text" id="vmqBatchPath" value="D:/douyin_downloads/wm-batch" readonly />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseVmqBatchPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="vmqBatchDownloadBtn" class="btn btn-primary" onclick="startVmqBatchDownload()">
                                <span>📦</span> 开始批量解析
                            </button>
                            <button class="btn btn-secondary" onclick="clearVmqBatchLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>

                        <div class="progress-container">
                            <div class="progress-bar">
                                <div class="progress-fill" id="vmqBatchProgressFill" style="width: 0%"></div>
                            </div>

                        </div>

                        <div class="log-container" id="vmqBatchLogArea">
                            <div class="log-entry info" style="left: -17px;">
                                <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                                <span>📦 批量解析系统已启动，等待任务...</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 铁粉圈视频 -->
                <div class="vmq-content" id="vmqTiefenquanVideo">
                    <div class="card glow-effect">
                        <div class="card-header">
                            <span class="card-icon">🎬</span>
                            <span class="card-title">铁粉圈视频专属解析</span>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="tiefenquanVideoUrl">🔗 铁粉圈视频链接</label>
                                <input type="text" id="tiefenquanVideoUrl" placeholder="粘贴铁粉圈视频页面链接..." />
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="tiefenquanVideoPath">💾 保存路径</label>
                                <input type="text" id="tiefenquanVideoPath" value="D:\douyin_downloads\tfq_videos" />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseTiefenquanVideoPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="tiefenquanVideoDownloadBtn" class="btn btn-primary"
                                onclick="startTiefenquanVideoDownload()">
                                <span>🎬</span> 开始解析
                            </button>
                            <button class="btn btn-secondary" onclick="clearTiefenquanVideoLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>

                        <div class="progress-container">
                            <div class="progress-bar">
                                <div class="progress-fill" id="tiefenquanVideoProgressFill" style="width: 0%"></div>
                            </div>

                        </div>

                        <div class="log-container" id="tiefenquanVideoLogArea">
                            <div class="log-entry info" style="left: -17px;">
                                <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                                <span>🎬 铁粉圈视频解析系统已启动，等待任务...</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 铁粉圈 -->
                <div class="vmq-content" id="vmqTiefenquan">
                    <div class="card glow-effect">
                        <div class="card-header">
                            <span class="card-icon">💠</span>
                            <span class="card-title">铁粉圈专属解析</span>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="tiefenquanUrl">🔗 铁粉圈链接</label>
                                <input type="text" id="tiefenquanUrl" placeholder="粘贴铁粉圈页面链接..." />
                            </div>
                        </div>

                        <div class="form-row">
                            <div class="form-group">
                                <label for="tiefenquanPath">💾 保存路径</label>
                                <input type="text" id="tiefenquanPath" value="D:\douyin_downloads\tiefenquan" />
                            </div>
                            <div class="form-group" style="flex: 0 0 120px;">
                                <label>&nbsp;</label>
                                <button class="btn btn-secondary" onclick="browseTiefenquanPath()">
                                    浏览
                                </button>
                            </div>
                        </div>

                        <div class="btn-group">
                            <button id="tiefenquanDownloadBtn" class="btn btn-primary"
                                onclick="startTiefenquanDownload()">
                                <span>💠</span> 开始解析
                            </button>
                            <button class="btn btn-secondary" onclick="clearTiefenquanLog()">
                                <span>🧹</span> 清空日志
                            </button>
                        </div>

                        <div class="progress-container">
                            <div class="progress-bar">
                                <div class="progress-fill" id="tiefenquanProgressFill" style="width: 0%"></div>
                            </div>

                        </div>

                        <div class="log-container" id="tiefenquanLogArea">
                            <div class="log-entry info" style="left: -17px;">
                                <span class="log-time">[${new Date().toLocaleTimeString()}]</span>
                                <span>💠 铁粉圈解析系统已启动，等待任务...</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- ⚙️ 系统设置页面 -->
            <div class="page" id="settingsPage">
                <div class="card glow-effect" style=" max-height: 38vw;">
                    <div class="card-header">
                        <span class="card-icon">⚙️</span>
                        <span class="card-title">系统配置中心</span>
                    </div>

                    <div class="nav-tabs">
                        <div class="nav-tab active" onclick="switchSettingsTab('proxy', event)">🌐 代理设置</div>
                        <div class="nav-tab" onclick="switchSettingsTab('cookies', event)">🍪 Cookie管理</div>
                        <div class="nav-tab" onclick="switchSettingsTab('password', event)">🔐 密码设置</div>
                        <div class="nav-tab" onclick="switchSettingsTab('advanced', event)">🔧 高级选项</div>
                    </div>

                    <div class="settings-content-wrapper">
                        <!-- 代理设置 -->
                        <div class="settings-content active" id="proxySettings">
                            <div class="form-row">
                                <div class="form-group">
                                    <label for="proxyHost">🌐 代理地址</label>
                                    <input type="text" id="proxyHost" value="127.0.0.1" />
                                </div>
                                <div class="form-group">
                                    <label for="proxyPort">🔌 端口</label>
                                    <input type="number" id="proxyPort" value="7890" />
                                </div>
                            </div>
                            <div class="btn-group">
                                <button class="btn btn-success" onclick="testProxy()">
                                    <span>🧪</span> 测试连接
                                </button>
                                <button class="btn btn-primary" onclick="saveProxySettings()">
                                    <span>💾</span> 保存设置
                                </button>
                            </div>
                        </div>

                        <!-- Cookie管理 -->
                        <div class="settings-content" id="cookieSettings">
                            <div class="settings-scroll-container">
                                <!-- 抖音Cookie设置 -->
                                <div class="cookie-platform-section">
                                    <div class="platform-header">
                                        <span class="platform-icon">🎵</span>
                                        <span class="platform-title">抖音 Cookie 设置</span>
                                    </div>
                                    <div class="form-group">
                                        <label for="douyinCookieInput">🍪 抖音Cookie数据</label>
                                        <textarea id="douyinCookieInput" rows="4"
                                            placeholder="粘贴抖音Cookie数据..."></textarea>
                                    </div>
                                    <div class="btn-group">
                                        <button class="btn btn-primary" onclick="updatePlatformCookies('douyin')">
                                            <span>🔄</span> 更新抖音Cookie
                                        </button>
                                        <button class="btn btn-secondary" onclick="clearPlatformCookies('douyin')">
                                            <span>🗑️</span> 清空抖音Cookie
                                        </button>
                                    </div>
                                </div>

                                <!-- 快手Cookie设置 -->
                                <div class="cookie-platform-section">
                                    <div class="platform-header">
                                        <span class="platform-icon">⚡</span>
                                        <span class="platform-title">快手 Cookie 设置</span>
                                    </div>
                                    <div class="form-group">
                                        <label for="kuaishouCookieInput">🍪 快手Cookie数据</label>
                                        <textarea id="kuaishouCookieInput" rows="4"
                                            placeholder="粘贴快手Cookie数据..."></textarea>
                                    </div>
                                    <div class="btn-group">
                                        <button class="btn btn-primary" onclick="updatePlatformCookies('kuaishou')">
                                            <span>🔄</span> 更新快手Cookie
                                        </button>
                                        <button class="btn btn-secondary" onclick="clearPlatformCookies('kuaishou')">
                                            <span>🗑️</span> 清空快手Cookie
                                        </button>
                                    </div>
                                </div>

                                <!-- B站Cookie设置 -->
                                <div class="cookie-platform-section">
                                    <div class="platform-header">
                                        <span class="platform-icon">📺</span>
                                        <span class="platform-title">B站 Cookie 设置</span>
                                    </div>
                                    <div class="form-group">
                                        <label for="bilibiliCookieInput">🍪 B站Cookie数据</label>
                                        <textarea id="bilibiliCookieInput" rows="4"
                                            placeholder="粘贴B站Cookie数据..."></textarea>
                                    </div>
                                    <div class="btn-group">
                                        <button class="btn btn-primary" onclick="updatePlatformCookies('bilibili')">
                                            <span>🔄</span> 更新B站Cookie
                                        </button>
                                        <button class="btn btn-secondary" onclick="clearPlatformCookies('bilibili')">
                                            <span>🗑️</span> 清空B站Cookie
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- 密码设置 -->
                        <div class="settings-content" id="passwordSettings">
                            <div class="form-group">
                                <label>🔐 付费区访问密码</label>
                                <div style="color: rgba(255,255,255,0.7); font-size: 14px; margin-bottom: 15px;">
                                    修改付费区访问密码，确保系统安全
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="currentPassword">🔑 当前密码</label>
                                <input type="password" id="currentPassword" placeholder="输入当前密码..." />
                            </div>

                            <div class="form-group">
                                <label for="newPassword">🆕 新密码</label>
                                <input type="password" id="newPassword" placeholder="输入新密码（至少4位）..." />
                            </div>

                            <div class="form-group">
                                <label for="confirmPassword">✅ 确认新密码</label>
                                <input type="password" id="confirmPassword" placeholder="再次输入新密码..." />
                            </div>

                            <div class="btn-group" style="margin-top: 10px;">
                                <button class="btn btn-primary" onclick="changePasswordSettings()">
                                    <span>🔄</span> 修改密码
                                </button>
                                <button class="btn btn-secondary" onclick="resetPasswordFields()">
                                    <span>🧹</span> 清空输入
                                </button>
                            </div>

                            <div id="passwordStatus"
                                style="margin-top: 15px; padding: 10px; border-radius: 8px; display: none;">
                                <div id="passwordStatusText"></div>
                            </div>
                        </div>

                        <!-- 高级选项 -->
                        <div class="settings-content" id="advancedSettings">
                            <div class="form-row">
                                <div class="form-group">
                                    <label for="threadCount">🧵 线程数量</label>
                                    <input type="number" id="threadCount" value="5" min="1" max="20" />
                                </div>
                                <div class="form-group">
                                    <label for="timeout">⏱️ 超时时间(秒)</label>
                                    <input type="number" id="timeout" value="30" min="10" max="120" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label>
                                    <input type="checkbox" id="autoRetry" checked>
                                    🔄 失败自动重试
                                </label>
                            </div>
                            <div class="btn-group" style="margin-top: 10px;">
                                <button class="btn btn-primary" onclick="saveAdvancedSettings()">
                                    <span>💾</span> 保存设置
                                </button>
                                <button class="btn btn-secondary" onclick="resetSettings()">
                                    <span>🔄</span> 重置默认
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 🛟 帮助页面 -->
        <div class="page" id="helpPage">
            <div class="card glow-effect">
                <div class="card-header">
                    <span class="card-icon">🛟</span>
                    <span class="card-title">使用指南 & 帮助中心</span>
                </div>

                <div class="nav-tabs">
                    <div class="nav-tab active" onclick="switchHelpTab('guide', event)">📖 使用指南</div>
                    <div class="nav-tab" onclick="switchHelpTab('faq', event)">❓ 常见问题</div>
                    <div class="nav-tab" onclick="switchHelpTab('about', event)">ℹ️ 关于软件</div>
                </div>

                <!-- 使用指南 -->
                <div class="help-content active" id="guideContent">
                    <div style="color: rgba(255,255,255,0.9); line-height: 1.6;">
                        <h3 style="color: var(--accent-color); margin-bottom: 15px;">🚀 快速开始</h3>
                        <p>1. <strong>抖音/快手解析</strong>：复制分享链接，粘贴到对应区域，点击开始解析</p>
                        <p>2. <strong>付费区解析</strong>：需要有效的页面链接和适当的访问权限</p>
                        <p>3. <strong>批量下载</strong>：选择分类和页码，系统将自动批量处理</p>

                        <h3 style="color: var(--accent-color); margin: 25px 0 15px 0;">⚙️ 高级功能</h3>
                        <p>• <strong>代理设置</strong>：支持HTTP/SOCKS代理，提高访问成功率</p>
                        <p>• <strong>Cookie管理</strong>：管理各平台的登录状态</p>
                        <p>• <strong>多线程下载</strong>：支持1-20个并发线程</p>
                        <p>• <strong>断点续传</strong>：自动处理网络中断</p>
                    </div>
                </div>

                <!-- 常见问题 -->
                <div class="help-content" id="faqContent">
                    <div style="color: rgba(255,255,255,0.9); line-height: 1.6;">
                        <h3 style="color: var(--accent-color); margin-bottom: 15px;">❓ 常见问题解答</h3>

                        <div style="margin-bottom: 20px;">
                            <strong>Q: 下载失败怎么办？</strong><br>
                            A: 检查网络连接、代理设置和Cookie状态
                        </div>

                        <div style="margin-bottom: 20px;">
                            <strong>Q: 支持哪些平台？</strong><br>
                            A: 抖音、快手等主流平台
                        </div>

                        <div style="margin-bottom: 20px;">
                            <strong>Q: 如何提高下载速度？</strong><br>
                            A: 使用高质量代理，适当增加线程数量
                        </div>

                        <div style="margin-bottom: 20px;">
                            <strong>Q: 批量下载卡住了？</strong><br>
                            A: 检查分类名称是否正确，网络是否稳定
                        </div>
                    </div>
                </div>

                <!-- 关于软件 -->
                <div class="help-content" id="aboutContent">
                    <div style="color: rgba(255,255,255,0.9); line-height: 1.6; text-align: center;">
                        <h2 style="color: var(--accent-color); margin-bottom: 20px;">🚀 CYBER LOADER v3.0</h2>
                        <p style="font-size: 1.1rem; margin-bottom: 20px;">量子级智能下载引擎</p>

                        <div
                            style="background: rgba(0,212,255,0.1); padding: 20px; border-radius: 15px; margin: 20px 0;">
                            <h3 style="color: var(--accent-secondary); margin-bottom: 15px;">✨ 核心特性</h3>
                            <p>🌐 全球CDN加速网络</p>
                            <p>🔒 军用级AES-256加密</p>
                            <p>🧠 AI智能识别算法</p>
                            <p>⚡ 多线程并发处理</p>
                            <p>🛡️ 反爬虫检测机制</p>
                        </div>

                        <div style="margin-top: 30px;">
                            <p><strong>开发团队</strong>：中鄂智创科技</p>
                            <p><strong>技术支持</strong>：7x24小时在线服务</p>
                            <p><strong>版权所有</strong>：© 2025 All Rights Reserved</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>

    <!-- 🎯 JavaScript核心 -->
    <script src="/static/js/auth.js?v=2.1.1"></script>
    <script src="/static/js/navigation.js?v=2.1.1"></script>
    <script src="/static/js/downloads.js?v=2.1.1"></script>
    <script src="/static/js/settings.js?v=2.1.1"></script>
    <script src="/static/js/file-selector.js?v=2.1.1"></script>
    <script src="/static/js/websocket.js?v=2.1.1"></script>
    <script src="/static/js/app.js?v=2.1.1"></script>

    <!-- 🔧 确保所有函数在DOM加载完成后可用 -->
    <script>
        // 密码修改相关函数 - 确保立即可用
        window.changePasswordSettings = async function () {
            const currentPassword = document.getElementById('currentPassword').value.trim();
            const newPassword = document.getElementById('newPassword').value.trim();
            const confirmPassword = document.getElementById('confirmPassword').value.trim();
            const statusDiv = document.getElementById('passwordStatus');
            const statusText = document.getElementById('passwordStatusText');

            // 隐藏之前的状态
            statusDiv.style.display = 'none';

            // 验证输入
            if (!currentPassword) {
                showPasswordStatus('请输入当前密码', 'error');
                return;
            }

            if (!newPassword) {
                showPasswordStatus('请输入新密码', 'error');
                return;
            }

            if (newPassword.length < 4) {
                showPasswordStatus('新密码长度至少为4位', 'error');
                return;
            }

            if (newPassword !== confirmPassword) {
                showPasswordStatus('两次输入的新密码不一致', 'error');
                return;
            }

            if (currentPassword === newPassword) {
                showPasswordStatus('新密码不能与当前密码相同', 'error');
                return;
            }

            try {
                // 发送密码修改请求
                const response = await fetch('/api/password/change', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({
                        current_password: currentPassword,
                        new_password: newPassword,
                        client_id: window.clientId || 'web_client'
                    })
                });

                const result = await response.json();

                if (result.success) {
                    showPasswordStatus('✅ 密码修改成功！', 'success');
                    // 显示Toast通知
                    if (typeof showToast === 'function') {
                        showToast('🔒 密码修改成功！', 'success');
                    } else {
                        console.log('🔒 密码修改成功！');
                        alert('🔒 密码修改成功！');
                    }
                    // 清空输入框
                    resetPasswordFields();
                } else {
                    showPasswordStatus(`❌ ${result.message}`, 'error');
                }
            } catch (error) {
                console.error('密码修改请求失败:', error);
                showPasswordStatus('❌ 网络请求失败，请检查连接', 'error');
            }
        };

        window.resetPasswordFields = function () {
            document.getElementById('currentPassword').value = '';
            document.getElementById('newPassword').value = '';
            document.getElementById('confirmPassword').value = '';
            document.getElementById('passwordStatus').style.display = 'none';
        };

        window.showPasswordStatus = function (message, type) {
            const statusDiv = document.getElementById('passwordStatus');
            const statusText = document.getElementById('passwordStatusText');

            statusText.textContent = message;

            // 设置样式
            statusDiv.style.display = 'block';
            statusDiv.style.backgroundColor = type === 'success' ? 'rgba(76, 175, 80, 0.2)' : 'rgba(244, 67, 54, 0.2)';
            statusDiv.style.border = type === 'success' ? '1px solid rgba(76, 175, 80, 0.5)' : '1px solid rgba(244, 67, 54, 0.5)';
            statusText.style.color = type === 'success' ? '#4CAF50' : '#F44336';

            // 3秒后自动隐藏
            setTimeout(() => {
                statusDiv.style.display = 'none';
            }, 3000);
        };

        // 等待所有脚本加载完成后再初始化
        window.addEventListener('load', function () {
            console.log('🌟 所有脚本加载完成，开始初始化...');

            // 确保所有函数都可用
            if (typeof initApp === 'function') {
                initApp();
            } else {
                console.error('❌ initApp函数未找到');
            }

            // 初始化页面内容显示
            if (typeof initializePageContent === 'function') {
                initializePageContent();
            } else {
                console.error('❌ initializePageContent函数未找到');
            }

            // 检查关键函数是否存在
            const requiredFunctions = [
                'switchPage', 'switchMode', 'switchVmqMode',
                'switchSettingsTab', 'switchHelpTab', 'checkAuthenticationStatus',
                'verifyPremiumPassword', 'performPageSwitch', 'changePasswordSettings', 'resetPasswordFields'
            ];

            requiredFunctions.forEach(funcName => {
                if (typeof window[funcName] !== 'function') {
                    console.error(`❌ 函数 ${funcName} 未定义`);
                } else {
                    console.log(`✅ 函数 ${funcName} 已加载`);
                }
            });

            // 测试页面切换功能
            console.log('🧪 测试页面切换功能...');
            setTimeout(() => {
                if (typeof switchPage === 'function') {
                    console.log('✅ switchPage函数可用');
                } else {
                    console.error('❌ switchPage函数不可用');
                }
            }, 1000);
        });

        // 添加错误处理
        window.addEventListener('error', function (e) {
            console.error('🚨 全局错误:', e.error);
            console.error('错误位置:', e.filename, ':', e.lineno);
        });
    </script>

    <!-- 🌟 超级动态特效初始化 -->
    <script>
        // 全局特效控制器
        class CyberEffectsController {
            constructor() {
                this.isInitialized = false;
                this.particles = [];
                this.matrixChars = '01アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン';
                this.loadingProgress = 0;
            }

            // 初始化所有特效
            async init() {
                if (this.isInitialized) return;

                console.log('🚀 初始化CYBER特效系统...');
                await this.showLoadingScreen();
                this.initMatrixRain();
                this.initQuantumParticles();
                this.initNebulaCloud();
                this.initEnergyWaves();
                this.initInteractiveEffects();
                this.isInitialized = true;
                console.log('✨ CYBER特效系统初始化完成！');
            }

            // 显示加载屏幕
            async showLoadingScreen() {
                const loadingScreen = document.getElementById('loadingScreen');
                const loadingFill = document.getElementById('loadingFill');
                const loadingText = document.getElementById('loadingText');

                const loadingSteps = [
                    '初始化量子引擎...',
                    '连接神经网络...',
                    '同步全球节点...',
                    '加载粒子系统...',
                    '启动矩阵雨...',
                    '准备用户界面...',
                    '系统就绪！'
                ];

                loadingScreen.style.display = 'flex';

                for (let i = 0; i < loadingSteps.length; i++) {
                    this.loadingProgress = (i + 1) / loadingSteps.length * 100;
                    loadingFill.style.width = this.loadingProgress + '%';
                    loadingText.textContent = loadingSteps[i];
                    await new Promise(resolve => setTimeout(resolve, 300));
                }

                await new Promise(resolve => setTimeout(resolve, 500));
                loadingScreen.style.opacity = '0';
                setTimeout(() => {
                    loadingScreen.style.display = 'none';
                }, 500);
            }

            // 矩阵雨效果
            initMatrixRain() {
                const canvas = document.getElementById('matrixRain');
                const ctx = canvas.getContext('2d');

                canvas.width = window.innerWidth;
                canvas.height = window.innerHeight;

                const columns = Math.floor(canvas.width / 20);
                const drops = Array(columns).fill(1);

                const drawMatrix = () => {
                    ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
                    ctx.fillRect(0, 0, canvas.width, canvas.height);

                    ctx.fillStyle = '#00ff41';
                    ctx.font = '15px monospace';

                    for (let i = 0; i < drops.length; i++) {
                        const text = this.matrixChars[Math.floor(Math.random() * this.matrixChars.length)];
                        ctx.fillText(text, i * 20, drops[i] * 20);

                        if (drops[i] * 20 > canvas.height && Math.random() > 0.975) {
                            drops[i] = 0;
                        }
                        drops[i]++;
                    }
                };

                setInterval(drawMatrix, 50);

                window.addEventListener('resize', () => {
                    canvas.width = window.innerWidth;
                    canvas.height = window.innerHeight;
                });
            }

            // 量子粒子系统
            initQuantumParticles() {
                const container = document.getElementById('quantumParticles');
                const particleCount = 100;

                for (let i = 0; i < particleCount; i++) {
                    const particle = document.createElement('div');
                    particle.className = 'quantum-particle';

                    const size = Math.random() * 4 + 1;
                    const x = Math.random() * 100;
                    const y = Math.random() * 100;
                    const duration = Math.random() * 10 + 5;
                    const delay = Math.random() * 5;

                    particle.style.cssText = `
                        position: absolute;
                        left: ${x}%;
                        top: ${y}%;
                        width: ${size}px;
                        height: ${size}px;
                        background: radial-gradient(circle, #00d4ff, transparent);
                        border-radius: 50%;
                        animation: quantumFloat ${duration}s ${delay}s infinite ease-in-out;
                        opacity: 0.7;
                    `;

                    container.appendChild(particle);
                    this.particles.push(particle);
                }
            }

            // 星云云朵效果
            initNebulaCloud() {
                const nebula = document.getElementById('nebulaCloud');
                const cloudCount = 5;

                for (let i = 0; i < cloudCount; i++) {
                    const cloud = document.createElement('div');
                    cloud.className = 'nebula-cloud-item';

                    const size = Math.random() * 300 + 200;
                    const x = Math.random() * 100;
                    const y = Math.random() * 100;
                    const duration = Math.random() * 20 + 10;

                    cloud.style.cssText = `
                        position: absolute;
                        left: ${x}%;
                        top: ${y}%;
                        width: ${size}px;
                        height: ${size}px;
                        background: radial-gradient(circle, rgba(102,126,234,0.1), rgba(255,107,157,0.1), transparent);
                        border-radius: 50%;
                        animation: nebulaFloat ${duration}s infinite ease-in-out;
                        filter: blur(50px);
                    `;

                    nebula.appendChild(cloud);
                }
            }

            // 能量波效果
            initEnergyWaves() {
                const waves = document.querySelector('.energy-waves');
                const waveCount = 3;

                for (let i = 0; i < waveCount; i++) {
                    const wave = document.createElement('div');
                    wave.className = 'energy-wave';

                    wave.style.cssText = `
                        position: absolute;
                        top: 50%;
                        left: 50%;
                        width: ${(i + 1) * 200}px;
                        height: ${(i + 1) * 200}px;
                        border: 2px solid rgba(0,212,255,0.3);
                        border-radius: 50%;
                        transform: translate(-50%, -50%);
                        animation: energyPulse ${3 + i}s infinite ease-in-out;
                        animation-delay: ${i * 0.5}s;
                    `;

                    waves.appendChild(wave);
                }
            }

            // 交互式特效
            initInteractiveEffects() {
                // 鼠标跟随光标
                document.addEventListener('mousemove', (e) => {
                    this.createCursorEffect(e.clientX, e.clientY);
                });

                // 点击波纹效果
                document.addEventListener('click', (e) => {
                    this.createRippleEffect(e.clientX, e.clientY);
                });
            }

            // 创建光标效果
            createCursorEffect(x, y) {
                const cursor = document.createElement('div');
                cursor.style.cssText = `
                    position: fixed;
                    left: ${x - 10}px;
                    top: ${y - 10}px;
                    width: 20px;
                    height: 20px;
                    background: radial-gradient(circle, rgba(0,212,255,0.8), transparent);
                    border-radius: 50%;
                    pointer-events: none;
                    z-index: 9999;
                    animation: cursorFade 1s ease-out forwards;
                `;

                document.body.appendChild(cursor);
                setTimeout(() => cursor.remove(), 1000);
            }

            // 创建波纹效果
            createRippleEffect(x, y) {
                const ripple = document.createElement('div');
                ripple.style.cssText = `
                    position: fixed;
                    left: ${x - 25}px;
                    top: ${y - 25}px;
                    width: 50px;
                    height: 50px;
                    border: 2px solid rgba(0,212,255,0.8);
                    border-radius: 50%;
                    pointer-events: none;
                    z-index: 9998;
                    animation: rippleExpand 1s ease-out forwards;
                `;

                document.body.appendChild(ripple);
                setTimeout(() => ripple.remove(), 1000);
            }
        }

        // 创建全局特效控制器实例
        const cyberEffects = new CyberEffectsController();

        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', async function () {
            console.log('🌟 启动 CYBER LOADER v4.0...');
            await cyberEffects.init();
        });

        // 动态样式注入
        const dynamicStyles = document.createElement('style');
        dynamicStyles.textContent = `
            @keyframes quantumFloat {
                0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
                50% { transform: translateY(-20px) rotate(180deg); opacity: 1; }
            }
            @keyframes nebulaFloat {
                0%, 100% { transform: translate(0, 0) scale(1); }
                50% { transform: translate(20px, -10px) scale(1.1); }
            }
            @keyframes energyPulse {
                0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
                50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.6; }
            }
            @keyframes cursorFade {
                from { opacity: 0.8; transform: scale(1); }
                to { opacity: 0; transform: scale(2); }
            }
            @keyframes rippleExpand {
                from { transform: scale(1); opacity: 0.8; }
                to { transform: scale(3); opacity: 0; }
            }
        `;
        document.head.appendChild(dynamicStyles);
    </script>
</body>

</html>